package com.hjxr.quota.datasource.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hjxr.quota.datasource.domain.ColnameAlias;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 数据表别名访问层
 *
 * @author sun
 * @version v1.0
 * @since 2020-08-16
 */
@Mapper
public interface ColnameAliasMapper extends BaseMapper<ColnameAlias>{
    int update(ColnameAlias colnameAlias);
    List<ColnameAlias> selectColnameAlias(ColnameAlias colnameAlias);
    List<ColnameAlias> selectByTablenameAliasId(int tablenameAliasId);
    ColnameAlias selectByColumnName(@Param("tablenameAliasId") Integer tablenameAliasId, @Param("columnName") String columnName);

    /**
     * 根据维度id获取相关字段名
     * @param id 维度id
     * @return
     */
    String queryName(Integer id);

    /**
     * 根据指标id获取相关字段类型
     * @param id 指标id
     * @return
     */
    String dataType(Integer id);
}
